<?php
if (!defined('IN_DISCUZ')){
	exit('Access Denied');
}

global $_G;
$mySql = ' AND p.hot = 1';
$moreJS = 1;

$view = isset($_G['gp_view']) ? strval($_G['gp_view']) : 'grid';
$page = isset($_G['gp_page']) ? intval($_G['gp_page']) : 0;
$sort = isset($_G['gp_sort']) ? strval($_G['gp_sort']) : 'last';

//////////////////////////////////////////////////////////////////////////////////////

$limit = $item_per_page;
$curpage = is_numeric($_G['gp_page']) ? intval($_G['gp_page']) : 1;
$start = ($curpage - 1) * $limit;
$count = 0;

$_G['gp_ajaxtarget'] = 'listproduct_display';

$xUrl = '';
$vUrl = '';
$sUrl = 'shop.php?name=hot-products';

if ($sort)
	$xUrl = '&amp;sort=' . $sort;
if ($page)
	$xUrl = '&amp;page=' . $page;
if ($view){
	$xUrl = '&amp;view=' . $view;
	$vUrl = $sUrl . $xUrl;
}

$url = $sUrl . $xUrl;

$result = productList(0, $mySql, $sort, $start, $limit, $count, true, true);
$pages = multi($count, $limit, $curpage, $url, 0, 10, false, false, 0);

$have = count($result);

unset($_G['gp_ajaxtarget']);

/*********************SEO category***********************/
$navtitle = lang("shop/template", 'san_pham_noi_bat');

switch ($sort){
	case 'pasc':
		$navtitle .= lang('shop/template', 'title_gia_thap_nhat');
	break;
	case 'pdesc':
		$navtitle .= lang('shop/template', 'title_gia_cao_nhat');
	break;
	case 'sale':
		$navtitle .= lang('shop/template', 'title_hang_giam_gia');
	break;
}

$metakeywords = $metadescription = $navtitle;
//////////////////////////////////////////////////////////////////////////////////////////////////////////////

include template('shop/hot_category');